package com.qujia.station.mapper;


//import com.qujia.coupon.domain.AppUserInfo;
//import com.qujia.label.domain.CustomerLabelDemo;
import com.qujia.station.domain.SysAppUserInfo;
import com.qujia.station.domain.YunHuaUser;
import com.qujia.station.domain.dto.SyncUserDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 会员信息信息Mapper接口
 *
 * @author qujia
 * @date 2021-10-24
 */
@Repository
public interface AppUserInfoMapper
{


    public void increaseShareCount(@Param("userId") Long userId);
    public Integer getShareCountByUserId(@Param("userId") Long userId);
    /**
     * 查询会员信息，该查询不返回电子卡余额
     *
     * @param userId 会员信息
     * @return 会员信息
     */
    public SysAppUserInfo selectAppUserInfoById(Long userId);

    public SysAppUserInfo selectAppUserInfoByPhone(String phone);
    List<SysAppUserInfo> selectAppUserInfoByPhoneAndStationId(Map<String, Object> params);
    /**
     * 查询新用户
     *
     * @param enterpriseId 油企id
     * @return 会员信息
     */
    public List<SysAppUserInfo> selectNewAppUser(Long enterpriseId);
    /**
     * 查询会员统计信息
     *
     * @param appUserInfo 会员信息
     * @return 油罐信息
     */
    public SysAppUserInfo selectAppUserInfoSum(SysAppUserInfo appUserInfo);
    /**
     * 查询会员信息列表，该查询不返回电子卡余额
     *
     * @param appUserInfo 会员信息
     * @return 会员信息集合
     */
    public List<SysAppUserInfo> selectAppUserInfoList(SysAppUserInfo appUserInfo);

    /**
     * 查询会员信息列表，用于手动发券
     *
     * @param customerLabelDemo 会员信息
     * @return 会员信息集合
     */
//    public List<CustomerLabelDemo> selectAppUserInfoListForCoupon(CustomerLabelDemo customerLabelDemo);

    /**
     * 新增会员信息
     *
     * @param appUserInfo 会员信息
     * @return 结果
     */
    public int insertAppUserInfo(SysAppUserInfo appUserInfo);

    /**
     * 修改会员信息
     *
     * @param appUserInfo 会员信息
     * @return 结果
     */
    public int updateMember(SysAppUserInfo appUserInfo);

    public int updateAppUserInfo(SysAppUserInfo appUserInfo);

    /**
     * 删除会员信息
     *
     * @param userId 会员信息ID
     * @return 结果
     */
    public int deleteAppUserInfoById(Long userId);

    /**
     * 批量删除会员信息
     *
     * @param userIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteAppUserInfoByIds(Long[] userIds);

    List<SysAppUserInfo> selectList(SysAppUserInfo appUserInfo);

    SysAppUserInfo getOne(SysAppUserInfo appUserInfo);

    //查询还没同步过的用户信息
    public List<SysAppUserInfo> getNotSyncYunHuaUser();


    public int updateYunHuaUserIdByPhone(SysAppUserInfo appUserInfo);

    int updateIsSyncByPhone(String mobilePhone);

    Long getAppNewUserNumber(SysAppUserInfo appUserInfo);

    Long getAppUserSum(SysAppUserInfo appUserInfo);

    List<SysAppUserInfo> getappMemberCodeIsNull(Long enterpriseId);

    int RepeatOrNotMemberCode(String memberCode);

     int updateMemberCode(SysAppUserInfo appUserInfo);

    SysAppUserInfo getUserRegisteDateByPhoneAndStationId(@Param("mobilePhone") String mobilePhone,@Param("stationId") Long stationId);

    void insertOrUpdateYunHuaUserId(SyncUserDto userDto);

    void batchUpdateIsSyncUser(List<YunHuaUser> yunHuaUserList);

    void updateIsSyncAndIdByPhone(List<YunHuaUser> yunHuaUser);

    void batchInsertYunHuaUser(List<SyncUserDto> yunHuaUserList);
    /**
     * 首页统计会员总数、今日新增会员数
     * */
    Long selectMemberNum(SysAppUserInfo appUserInfo);
}
